<?php

/**
 * Members filter form base class.
 *
 * @package    cpfaizenay
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseMembersFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'pseudo'                  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'datetime_register'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'datetime_last_connexion' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'email'                   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'password'                => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'auto_redirect'           => new sfWidgetFormChoice(array('choices' => array('' => '', 'accueil' => 'accueil', 'site' => 'site', 'admin' => 'admin'))),
      'title'                   => new sfWidgetFormChoice(array('choices' => array('' => '', 'M.' => 'M.', 'Mme' => 'Mme', 'Mlle' => 'Mlle'))),
      'firstname'               => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'lastname'                => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'role'                    => new sfWidgetFormFilterInput(),
      'status'                  => new sfWidgetFormChoice(array('choices' => array('' => '', 'superAdmin' => 'superAdmin', 'admin' => 'admin', 'moderator' => 'moderator', 'captain' => 'captain'))),
      'main_group'              => new sfWidgetFormFilterInput(),
      'login_allowed'           => new sfWidgetFormChoice(array('choices' => array('' => '', 0 => '0', 1 => '1'))),
      'picture'                 => new sfWidgetFormFilterInput(),
      'rights'                  => new sfWidgetFormFilterInput(),
      'id_licensee'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Licensee'), 'add_empty' => true)),
      'id_file_avatar'          => new sfWidgetFormFilterInput(),
      'cookie_key'              => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'pseudo'                  => new sfValidatorPass(array('required' => false)),
      'datetime_register'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'datetime_last_connexion' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'email'                   => new sfValidatorPass(array('required' => false)),
      'password'                => new sfValidatorPass(array('required' => false)),
      'auto_redirect'           => new sfValidatorChoice(array('required' => false, 'choices' => array('accueil' => 'accueil', 'site' => 'site', 'admin' => 'admin'))),
      'title'                   => new sfValidatorChoice(array('required' => false, 'choices' => array('M.' => 'M.', 'Mme' => 'Mme', 'Mlle' => 'Mlle'))),
      'firstname'               => new sfValidatorPass(array('required' => false)),
      'lastname'                => new sfValidatorPass(array('required' => false)),
      'role'                    => new sfValidatorPass(array('required' => false)),
      'status'                  => new sfValidatorChoice(array('required' => false, 'choices' => array('superAdmin' => 'superAdmin', 'admin' => 'admin', 'moderator' => 'moderator', 'captain' => 'captain'))),
      'main_group'              => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'login_allowed'           => new sfValidatorChoice(array('required' => false, 'choices' => array(0 => '0', 1 => '1'))),
      'picture'                 => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'rights'                  => new sfValidatorPass(array('required' => false)),
      'id_licensee'             => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Licensee'), 'column' => 'id_licensee')),
      'id_file_avatar'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'cookie_key'              => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('members_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Members';
  }

  public function getFields()
  {
    return array(
      'id_member'               => 'Number',
      'pseudo'                  => 'Text',
      'datetime_register'       => 'Date',
      'datetime_last_connexion' => 'Date',
      'email'                   => 'Text',
      'password'                => 'Text',
      'auto_redirect'           => 'Enum',
      'title'                   => 'Enum',
      'firstname'               => 'Text',
      'lastname'                => 'Text',
      'role'                    => 'Text',
      'status'                  => 'Enum',
      'main_group'              => 'Number',
      'login_allowed'           => 'Enum',
      'picture'                 => 'Number',
      'rights'                  => 'Text',
      'id_licensee'             => 'ForeignKey',
      'id_file_avatar'          => 'Number',
      'cookie_key'              => 'Text',
    );
  }
}
